package cn.wolfcode.enums;

import lombok.Getter;

/**
 * @Author chenhui
 * @Date 2021/1/14 10:58
 **/
@Getter
public enum ConsumptionReportEnum {

    BUSINESS("门店","b.name"),
    YEAR("年","DATE_FORMAT(c.pay_time,'%Y')"),
    MONTH("月","DATE_FORMAT(c.pay_time,'%Y-%m')"),
    DAY("日","DATE_FORMAT(c.pay_time,'%Y-%m-%d')");

    private String name;
    private String value;

    ConsumptionReportEnum(String name, String value){
        this.name = name;
        this.value = value;
    }

    public static String findName(String value){
        //获取所有示例
        ConsumptionReportEnum[] enums = values();
        for (ConsumptionReportEnum anEnum :  enums) {
            //判断实例中的value是否等于传入的value
            if(anEnum.value.equals(value)){
                return anEnum.name;
            }
        }
        return null;
    }



}
